package com.kuang.lambda;

public class TestLambda01 {
    //3.静态内部类
    static class Like2 implements ILike{
        public void like() {
            System.out.println("I Love You Too!");
        }
    }

    public static void main(String[] args) {
        ILike like1 = new Like();
        like1.like();

        Like2 like2 = new Like2();
        like2.like();

        //4.局部内部类
        class Like3 implements ILike{
            public void like() {
                System.out.println("I Love You More!");
            }
        }

        Like3 like3 = new Like3();
        like3.like();

        //5.匿名内部类
        ILike iLike4 = new ILike() {
            public void like() {
                System.out.println("I Love You More Than You!");
            }
        };
        iLike4.like();

        //6.用lambda简化
        like1=()->System.out.println("I Love You More Than You Hi Hi...!");
        like1.like();


    }

}

//1.定义一个函数式接口
interface ILike{
    void like();
}

//2.实现类
class Like implements ILike{
    public void like() {
        System.out.println("I Love You!");
    }
}